package com.zt.observer.service;

import com.zt.observer.domain.Apply;
import com.zt.observer.event.ApplyEvent;
import jdk.nashorn.internal.runtime.logging.Logger;
import lombok.extern.java.Log;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.stereotype.Service;

/**
 * 申请
 *
 * @author zt
 * @date 2021/12/9 17:11
 */
@Slf4j
@Service
public class ApplyService implements ApplicationEventPublisherAware {

    private ApplicationEventPublisher applicationEventPublisher;


    public void insertApply(Apply apply) {
        log.info("apply");
        register(apply);
    }


    @Override
    public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
        this.applicationEventPublisher = applicationEventPublisher;
    }

    private void register(Apply apply) {
        applicationEventPublisher.publishEvent(new ApplyEvent(this,apply));
    }



}
